Component({
  properties: {
    text: { type: null, value: [] },
    width: { type: Number, value: 0 },
    feedId: { type: Number, value: 0 },
  },
  data: {
    screenWidth: 0,
    showMoreTip: false,
  },
  lifetimes: {
    attached() {
      const query = wx.createSelectorQuery().in(this)
      query
        .select('#content')
        .boundingClientRect((rect: any) => {
          const lineHight = 28

          const showMoreTip = rect.height > lineHight * 3
          this.setData({ showMoreTip })
        })
        .exec()
    },
  },
  methods: {
    toDetail(e: WechatMiniprogram.BaseEvent) {
      const id = e.currentTarget.dataset.id as number
      wx.navigateTo({
        url: `/pages/feed/detail/detail?id=${id}`,
      })
    },
  },
})
